<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8"%>

<%@ include file="../include/head.jsp"%>
<%@ include file="../include/top.jsp"%>
<%@ include file="../include/left.jsp"%>
<div class="main-content">

	<%@ include file="../include/navigate.jsp"%>

	<div class="container">
		<div class="widget-box">
			<div class="widget-box-header">
				<div class="col-sm-2">
					<div class="title">
						<i class="icon-edit">&nbsp;</i>创建加密SQL
					</div>
				</div>
			</div>
			
			<div class="widget-box-content" style="padding: 15px;">
				<c:if test="${not empty message}">
					<div class="alert alert-danger" role="alert">${message}</div>
				</c:if>
				
				<form class="form-horizontal" role="form" onsubmit="return setScriptValue();" action="${pageContext.request.contextPath}/template_para/createSimpleXmlJob" method="post">
					<div class="form-group">
						<label class="col-sm-2 control-label">SQL脚本标题:</label>

						<div class="col-sm-8">
							<input type="text" class="form-control" name="title" data-toggle="tooltip" data-placement="left" required="">
						</div>
					</div>
					
					<div class="form-group">
						<label class="col-sm-2 control-label">创建给:</label>

						<div class="col-sm-8">
							<select class="form-control" id="userSelect">
								<option id="op" name="">test1</option>
								<option id="op" name="">test2</option>
								<option id="op" name="">test3</option>
								<c:forEach items="${allRoles}" var="role">
									<option id="op_${role.roleId}" name="${role.des}">${role.roleName}</option>
								</c:forEach>
							</select>
						</div>
					</div>
					
					<div class="form-group">
						<label class="col-sm-2 control-label">SQL:</label>
						
						<div class="col-sm-8">
							<input type="hidden" name="sqlScript" />
							<pre id="editor" style="height:300px"></pre>
						</div>
					</div>
					
					<div class="form-group">
	                    <label class="col-sm-2 control-label">备注:</label>
	
	                    <div class="col-sm-8">
							<textarea class="autosize-transition form-control" name="note" style="overflow: hidden; word-wrap: break-word; resize: vertical;"></textarea>
	                    </div>
	                </div>
					
					<div class="form-group">
						<label class="col-sm-2 control-label"></label>

						<div class="col-sm-5">
							<button type="submit" class="btn btn-success">提交</button>
							<a type="button" class="btn btn-primary" href="${pageContext.request.contextPath}/EtlXml/list"> 返回列表
							</a>
						</div>
					</div>
				</form>
			</div>
		</div>

		<div style="position: fixed; bottom: 0px; width: 100%;" align="center">
			<%@ include file="../include/footer.jsp"%>
		</div>
	</div>

	<script type="text/javascript">
	    var editor = ace.edit("editor");
	    editor.session.setMode("ace/mode/sql");
	    
	    function setScriptValue(){
	    	$("input[name='sqlScript']").val(editor.getValue());
	    }
	</script>

	<%@ include file="../include/bottom.jsp"%>